package com.siyuanren.gcocp.mapper;

import com.siyuanren.gcocp.dto.ChapterDTO;
import com.siyuanren.gcocp.mapper.base.WxCourseChapterMapper;
import com.siyuanren.gcocp.vo.ClockChapterVO;
import com.siyuanren.gcocp.vo.QueryChapterDetailVO;
import com.siyuanren.gcocp.vo.QueryChapterVO;

import java.util.List;

/**
 * Created by   anxing
 * Project_name gcocp-parent
 * Path         com.siyuanren.gcocp.mapper
 * Date         2018/4/17
 * Time         13:08
 * Description
 */
public interface MyWxChapterMapper extends WxCourseChapterMapper {

    /**
     * 返回章节列表
     * @param queryChapterVO
     * @return
     *
     * SELECT t.`teacher_img`, t.`teacher_name`, wx_user_chapter.`chapter_score`, wx_user_chapter.`homework_complete`, wx_user_chapter.`last_content_id`,cc.*
    FROM wx_course c, wx_teacher t, wx_course_chapter cc
    LEFT JOIN wx_user_chapter ON cc.id = wx_user_chapter.`chapter_id` AND wx_user_chapter.`user_id`=1
    WHERE cc.`course_id`=12 AND c.id=cc.`course_id` AND c.`teacher_id` = t.id AND cc.`available`=1
    ORDER BY cc.`sort` DESC
     */
    public List<ChapterDTO> getChapterList(QueryChapterVO queryChapterVO) throws Exception;

    /**
     * 返回课程打卡列表
     * @param queryChapterVO
     * @return
     * SELECT uc.`clocked` FROM wx_user_chapter uc  WHERE user_id=1 AND course_id=1 AND uc.`available`=1
     */
    public List<Integer> getCourseClockList(QueryChapterVO queryChapterVO) throws Exception;

    /**
     * 返回章节详情
     * @param chapterDetailVO
     * @return
     * @throws Exception
     * SELECT t.`teacher_img`, t.`teacher_name`, wx_user_chapter.`chapter_score`, wx_user_chapter.`homework_complete`, wx_user_chapter.`last_content_id`,cc.*
    FROM wx_teacher t, wx_course_chapter cc
    LEFT JOIN wx_user_chapter ON cc.id = wx_user_chapter.`chapter_id` AND wx_user_chapter.`user_id`=1
    WHERE cc.`id`=1 AND cc.`teacher_id` = t.id AND cc.`available`=1
    ORDER BY cc.`chapter_number` DESC
     */
    List<ChapterDTO> getChapterDetail(QueryChapterDetailVO chapterDetailVO);
}
